package org.liulinlin.sejw.db;

import java.sql.*;

public class CustomerContact { //extends DataAccessServiceImpl {
	private String id;
	private String name;
	private String pos;
	private String mobile;
	private String oTel;
	private String hTel;
	private String fax;
	private String addr;
	private String email;
	private String main;
	
	public CustomerContact() {
		
	}
	public CustomerContact(String id) {
		DBConnectionManager connMgr = DBConnectionManager.getInstance();
		Connection con = connMgr.getConnection("shipping_export");
		if (con == null) {
			System.out.println("不能获得数据库连接");
			return;
		}
		
		try {
			Statement stmt = con.createStatement();
			ResultSet rs = stmt.executeQuery("select * from CustomerContact where CC_ID = '" + id + "'");
		
			rs.next();
			this.id = id;
			name = rs.getString("CC_Name");
			pos = rs.getString("CC_Pos");
			mobile = rs.getString("CC_Mobile");
			oTel = rs.getString("CC_OTel");
			hTel = rs.getString("CC_HTel");
			fax = rs.getString("CC_Fax");
			addr = rs.getString("CC_Addr");
			email = rs.getString("CC_Email");
			main = rs.getString("CC_Main");
		
			rs.close();
			stmt.close();
		} catch(SQLException e) {
			e.printStackTrace();
		}
		
		connMgr.freeConnection("shipping_export", con);
		connMgr.release();
	}
	
	public void setId(String id) {
		this.id = id;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setPos(String pos) {
		this.pos = pos;
	}
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	public void setOTel(String oTel) {
		this.oTel = oTel;
	}
	public void setHTel(String hTel) {
		this.hTel = hTel;
	}
	public void setFax(String fax) {
		this.fax = fax;
	}
	public void setAddr(String addr) {
		this.addr = addr;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public void setMain(String main) {
		this.main = main;
	}
	
	public String getId() {
		return id;
	}
	public String getName() {
		return name;
	}
	public String getPos() {
		return pos;
	}
	public String getMobile() {
		return mobile;
	}
	public String getOTel() {
		return oTel;
	}
	public String getHTel() {
		return hTel;
	}
	public String getFax() {
		return fax;
	}
	public String getAddr() {
		return addr;
	}
	public String getEmail() {
		return email;
	}
	public String getMain() {
		return main;
	}
}
